

template<class T>
MemoryPool<T>::MemoryPool()
{

}

template<class T>
MemoryPool<T>::~MemoryPool()
{
	while(m_kStack.empty() == false)
	{
		m_kStack.pop();
	}
}
template<class T>
bool MemoryPool<T>::CreatePool(uint32 size)
{
	m_pkValue = new T[size];
	if( m_pkValue == NULL )
		return false;

	for(uint32 i=0; i<size; ++i)
	{
		m_kStack.push(&(m_pkValue[i]));
	}
	return true;
}

template<class T>
T *MemoryPool<T>::Alloc()
{
	T *ret = m_kStack.top();
	m_kStack.pop();
	return ret;
}

template<class T>
void MemoryPool<T>::Free(T * value)
{
	m_kStack.push(value);
}